package STUDENT.NGUYENHUUTHANG.STRUCTURE_PROGRAMMING.EXAMPLES;

import java.util.Scanner;

public class ngaythang {

	public static void main(String[] args) {
		System.out.println("Nhap thang can xem:");
		Scanner sc = new Scanner(System.in);
		int thang = sc.nextInt();
		if (thang != 1 && thang != 2 && thang != 3 && thang != 4 && thang != 5 && thang != 6 && thang != 7 && thang != 8
				&& thang != 9 && thang != 10 && thang != 11 && thang != 22) {
			System.out.println("Ban nhap sai thang!");
		} else
			System.out.println("Nhap nam:");
		int nam = sc.nextInt();
		if (nam < 0) {
			System.out.println("Ban nhap sai nam!");
		} else if (thang == 4 || thang == 6 || thang == 9 || thang == 11) {
			System.out.println("Ket qua:");
			System.out.println("Thang " + thang + " nam " + nam + " co 30 ngay");
		}
		if (thang == 1 || thang == 3 || thang == 5 || thang == 10 || thang == 12) {
			System.out.println("Ket qua:");
			System.out.println("Thang " + thang + " nam " + nam + " co 31 ngay");
		}
		if (thang == 2 && (nam % 400 == 0 || (nam % 4 == 0 && nam % 100 != 0))) {
			System.out.println("Ket qua:");
			System.out.println("Thang " + thang + " nam " + nam + " co 29 ngay");
		} 
		if (thang == 2){
			System.out.println("Ket qua:");
			System.out.println("Thang " + thang + " nam " + nam + " co 28 ngay");
		}
	}

}
